home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
tsptp.zip
/
FLOAT.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-04-09
|
3KB
|
92 lines
(******************************************************************************)
(* RMATH.PAS *)
(* Real Math Benchmark. *)
(******************************************************************************)
PROGRAM FLOAT(Output);
(******************************************************************************)
(* TIMING *)
(******************************************************************************)
(*$IFNDEF TopSpeed *)
(*%F TRUE *** Compile for Turbo Pascal ***)
USES TPBench;
(*%E*)
(*$ELSE *** Compile for TopSpeed Pascal ***)
IMPORT TSBench *;
(*$ENDIF *)
(******************************************************************************)
CONST
CONST1 = 3.141597E0;
CONST2 = 1.7839032E4;
VAR
C : BmReal;
PROCEDURE FloatProc;
VAR
I : BmInt;
A, B : BmReal;
BEGIN
A := CONST1;
B := CONST2;
FOR I := 1 TO 10000 DO
BEGIN
C := A * B;
C := C / A;
C := A * B;
C := C / A;
C := A * B;
C := C / A;
C := A * B;
C := C / A;
C := A * B;
C := C / A;
C := A * B;
C := C / A;
C := A * B;
C := C / A
END;
END;
BEGIN
WriteLn('Float Benchmark');
(******************************************************************************)
(* Compute the looping overhead. The Dummy procedure must have some side- *)
(* effect so that it is not optimised out of existence. *)
(******************************************************************************)
StartTimer; (* Start the clock. *)
REPEAT
Dummy;
UNTIL NullTimesUp;
(******************************************************************************)
(* Now run the benchmark. Note that the Dummy procedure is also called so *)
(* that we can eliminate its overhead from the looping overhead. *)
(******************************************************************************)
StartTimer; (* Start the clock. *)
REPEAT
FloatProc;
Dummy
UNTIL BenchTimesUp;
(******************************************************************************)
ReportTimes;
WriteLn;
WriteLn('Result: C = ', C:10);
END.